using System;
using System.Data;

using Wicresoft.Common;

namespace Wicresoft.Messages.Entity
{
	[Table("Option", "", "Wicresoft.Messages.ConnectionString")]
	public class Option : Info
	{
		#region SQL column name consts 
		public const string SQLCOL_OPTIONID = "OptionID";
		public const string SQLCOL_MESSAGEID = "MessageID";
		public const string SQLCOL_OPTIONKEY = "OptionKey";
		public const string SQLCOL_OPTIONTEXT = "OptionText";
		#endregion


		#region Contructors
		/// <summary>
		/// Construct empty entity
		/// </summary>
		public Option () {}

		/// <summary>
		/// Construct entity by primary key, other fields will be assigned by 
		/// "Load" method.
		/// </summary>
		public Option (Guid OptionID)
		{
			this.OptionID = OptionID;
		}
		#endregion

		public override void Init (DataRow row)
		{
			OptionID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_OPTIONID]);
			MessageID = (Guid)ObjectType.GuidTypeHelper.Read(row[SQLCOL_MESSAGEID]);
			OptionKey = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_OPTIONKEY]);
			OptionText = (string)ObjectType.StringTypeHelper.Read(row[SQLCOL_OPTIONTEXT]);
		}

		#region Properties 
		#region Property <Guid> OptionID
		[Property("OptionID", 16, SqlDbType.UniqueIdentifier, false, true)]
		public Guid OptionID 
		{
			get { return _OptionID; }
			set { _OptionID = value; }
		}
		private Guid _OptionID = Guid.Empty;
		#endregion

		#region Property <Guid> MessageID
		[Property("MessageID", 16, SqlDbType.UniqueIdentifier, false, false)]
		public Guid MessageID 
		{
			get { return _MessageID; }
			set { _MessageID = value; }
		}
		private Guid _MessageID = Guid.Empty;
		#endregion

		#region Property <string> OptionKey
		[Property("OptionKey", 200, SqlDbType.NVarChar, false, false)]
		public string OptionKey 
		{
			get { return _OptionKey; }
			set { _OptionKey = value; }
		}
		private string _OptionKey = null;
		#endregion

		#region Property <string> OptionText
		[Property("OptionText", 2147483646, SqlDbType.NText, false, false)]
		public string OptionText 
		{
			get { return _OptionText; }
			set { _OptionText = value; }
		}
		private string _OptionText = null;
		#endregion
		#endregion




	}
}
